项目名称绑定是一个数据绑定类型,用于指定当使用了ItemNameBinding(在线文档 'ItemNameBinding 属性')属性时,图表数据的项目名称绑定。
下面的示例演示调用目标对象的绑定方法:
C# |
拷贝代码
|
---|---|
ChartBindings bindings = new ChartBindings(); bindings.ItemNameBinding = new Binding("Name"); bindings.SeriesBindings.Add(new Binding("Input")); bindings.SeriesBindings.Add(new Binding("Output")); chart.Bindings = bindings; chart.DataContext = new InOut[] { new InOut() { Name = "n1", Input = 90, Output = 110}, new InOut() { Name = "n2", Input = 80, Output = 70}, new InOut() { Name = "n3", Input = 100, Output = 100}, }; 在此,InOut 定义为: public class InOut { public string Name { get; set; } public double Input{ get; set;} public double Output { get; set; } } |